package com.seleniumplug;

import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;


public class ByName {

    @Test
    public void drive() {

        System.setProperty("webdriver.chrome.driver", "E:\\chromedriver.exe");
        WebDriver driver = new ChromeDriver();
        driver.get("http://www.douban.com");

        WebElement searchBox = driver.findElement(By.name("q"));
        searchBox.sendKeys("标题");
        searchBox.submit();

        driver.close();
    }
}
